]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
network: Fix a recursion issue when updating VPN
authorJasper St. Pierre <jstpierre@mecheye.net>
Wed, 3 Jul 2013 17:47:21 +0000 (13:47 -0400)
committerJasper St. Pierre <jstpierre@mecheye.net>
Wed, 3 Jul 2013 17:55:08 +0000 (13:55 -0400)
_updateIcon should not attempt to sync any active connections, as the
icon-changed signal can be emitted in response to something done during
_syncActiveConnection. In the case of VPN, removeActiveConnection would
cause an icon-changed signal to be emitted immediately, but the state
would not be updated, causing us to call removeActiveConnection over and
over.

Explicitly sync all active connections when we know it needs to be done,
and simply make _updateIcon synchronize with the current device's icon.

https://bugzilla.gnome.org/show_bug.cgi?id=703565

js/ui/status/network.js

index 923aaeaf4c55a085364b72a9d5a2e89f91018822..6cc9055ba579c0582c3ab23835c6f7ef810e3821 100644 (file)
@@ -1528,7 +1528,7 @@ const NMApplet = new Lang.Class({
         this._client.connect('notify::manager-running', Lang.bind(this, this._syncNMState));
         this._client.connect('notify::networking-enabled', Lang.bind(this, this._syncNMState));
         this._client.connect('notify::state', Lang.bind(this, this._syncNMState));
-        this._client.connect('notify::active-connections', Lang.bind(this, this._updateIcon));
+        this._client.connect('notify::active-connections', Lang.bind(this, this._syncActiveConnections));
         this._client.connect('device-added', Lang.bind(this, this._deviceAdded));
         this._client.connect('device-removed', Lang.bind(this, this._deviceRemoved));
         this._settings.connect('new-connection', Lang.bind(this, this._newConnection));
@@ -1761,8 +1761,8 @@ const NMApplet = new Lang.Class({
             let a = this._activeConnections[i];
 
             if (!a._inited) {
-                a._notifyDefaultId = a.connect('notify::default', Lang.bind(this, this._updateIcon));
-                a._notifyDefault6Id = a.connect('notify::default6', Lang.bind(this, this._updateIcon));
+                a._notifyDefaultId = a.connect('notify::default', Lang.bind(this, this._syncActiveConnections));
+                a._notifyDefault6Id = a.connect('notify::default6', Lang.bind(this, this._syncActiveConnections));
                 a._notifyStateId = a.connect('notify::state', Lang.bind(this, this._notifyActivated));
 
                 a._inited = true;
@@ -1814,6 +1814,7 @@ const NMApplet = new Lang.Class({
         if (this._mainConnection) {
             let dev = this._mainConnection._primaryDevice;
             this._mainConnectionIconChangedId = dev.connect('icon-changed', Lang.bind(this, this._updateIcon));
+            this._updateIcon();
         }
     },
 
@@ -1824,7 +1825,7 @@ const NMApplet = new Lang.Class({
             activeConnection._primaryDevice._notification = null;
         }
 
-        this._updateIcon();
+        this._syncActiveConnections();
     },
 
     _ignoreConnection: function(connection) {
@@ -1861,7 +1862,7 @@ const NMApplet = new Lang.Class({
 
     _newConnection: function(settings, connection) {
         this._addConnection(connection);
-        this._updateIcon();
+        this._syncActiveConnections();
     },
 
     _connectionRemoved: function(connection) {
@@ -1940,11 +1941,10 @@ const NMApplet = new Lang.Class({
         }
 
         this._showNormal();
-        this._updateIcon();
+        this._syncActiveConnections();
     },
 
     _updateIcon: function() {
-        this._syncActiveConnections();
         let hasApIcon = false;
         let hasMobileIcon = false;